/* 遮罩层 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay-open {
  opacity: 1;
}

/* 弹窗内容 */
.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content-open {
  transform: scale(1);
  opacity: 1;
}

/* 尺寸变体 */
.modal-sm {
  width: 90%;
  max-width: 400px;
}

.modal-md {
  width: 90%;
  max-width: 600px;
}

.modal-lg {
  width: 90%;
  max-width: 800px;
}

.modal-xl {
  width: 90%;
  max-width: 1000px;
}

.modal-full {
  width: 90%;
  max-width: 90vw;
}

/* 全屏模式 */
.modal-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

/* 位置 */
.modal-center {
  margin: auto;
}

.modal-top {
  margin-top: 100px;
  margin-bottom: auto;
}

/* 头部 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #000000d9;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #00000073;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  margin-left: 12px;
  flex-shrink: 0;
}

.modal-close:hover {
  color: #000000d9;
  background-color: #0000000a;
}

.modal-close:active {
  background-color: #00000014;
}

/* 内容区 */
.modal-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  color: #000000d9;
  font-size: 14px;
  line-height: 1.5715;
}

/* 底部 */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
}

/* 按钮样式 */
.modal-btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  outline: none;
}

.modal-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.modal-btn-cancel {
  background: #ffffff;
  border-color: #d9d9d9;
  color: #000000d9;
}

.modal-btn-cancel:hover:not(:disabled) {
  border-color: #4096ff;
  color: #4096ff;
}

.modal-btn-cancel:active:not(:disabled) {
  border-color: #0958d9;
  color: #0958d9;
}

.modal-btn-ok {
  background: #1677ff;
  border-color: #1677ff;
  color: #fff;
}

.modal-btn-ok:hover:not(:disabled) {
  background: #4096ff;
  border-color: #4096ff;
}

.modal-btn-ok:active:not(:disabled) {
  background: #0958d9;
  border-color: #0958d9;
}

/* 加载动画 */
.modal-btn-loading {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: modal-spin 0.6s linear infinite;
}

@keyframes modal-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 响应式 */
@media (max-width: 768px) {
  .modal-content {
    max-height: 90vh;
  }

  .modal-sm,
  .modal-md,
  .modal-lg,
  .modal-xl,
  .modal-full {
    width: 95%;
    max-width: 95vw;
  }

  .modal-top {
    margin-top: 50px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }
}

/* 滚动条样式 */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}